/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.isd.inventario.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Claudio
 */
@Entity
@Table(name = "STTDEI", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Sector.findAll", query = "SELECT s FROM Sector s")})
public class Sector implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SectorPK sectorPK;

    @Column(name = "STTDEI_SECTOR", insertable=false, updatable=false , length = 15)
    private String sector;

    @Basic(optional = false)
    @Column(name = "STTDEI_DESCRP", nullable = false, length = 60)
    private String descrp;

    @JoinColumn(name = "STTDEI_DEPOSI", referencedColumnName = "STTDEH_DEPOSI", nullable = false, insertable=false, updatable=false)
    @ManyToOne(optional = false)
    private Deposito deposito;
    
    @Column(name = "STTDEI_DEBAJA")
    private Character debaja;
    

    public Sector() {
    }

    public Sector(SectorPK sectorPK) {
        this.sectorPK = sectorPK;
    }

    public Sector(SectorPK sectorPK, String descrp) {
        this.sectorPK = sectorPK;
        this.descrp = descrp;
    }   

    public Sector(String sttdeiDeposi, String sttdeiSector) {
        this.sectorPK = new SectorPK(sttdeiDeposi, sttdeiSector);
    }

    public SectorPK getSectorPK() {
        return sectorPK;
    }

    public void setSectorPK(SectorPK sectorPK) {
        this.sectorPK = sectorPK;
    }

    public String getSector() {
        return sector;
    }

    public void setSector(String sector) {
        this.sector = sector;
    }

    public Deposito getDeposito() {
        return deposito;
    }

    public void setDeposito(Deposito deposito) {
        this.deposito = deposito;
    }

    public Character getDebaja() {
        return debaja;
    }

    public void setDebaja(Character debaja) {
        this.debaja = debaja;
    }

    public String getDescrp() {
        return descrp;
    }

    public void setDescrp(String descrp) {
        this.descrp = descrp;
    }

    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sectorPK != null ? sectorPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sector)) {
            return false;
        }
        Sector other = (Sector) object;
        if ((this.sectorPK == null && other.sectorPK != null) || (this.sectorPK != null && !this.sectorPK.equals(other.sectorPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tv.inventario.modelo.Sector[sectorPK=" + sectorPK + "]";
    }

}
